home *** CD-ROM | disk | FTP | other *** search
- Path: unsw.edu.au!gwong
- From: gwong@cse.unsw.edu.au (Geoffrey Wong)
- Newsgroups: comp.std.c
- Subject: y
- Date: 17 Jan 1996 06:48:08 GMT
- Organization: University of New South Wales
- Message-ID: <4di638$8tl@mirv.unsw.edu.au>
- NNTP-Posting-Host: thesis.circus.cse.unsw.edu.au
- X-Newsreader: TIN [version 1.2 PL2]
-
- thanks for your help with the last problem.
-
- However I have the follow relate problem. This time I have a structure that
- constains a head and a body.
-
- struct _rlgg_rec
-
- {
-
- SLiteral head;
-
- SLiteral *body;
-
- int size;
-
- };
-
-
-
-
-
-
- Now goal is an _rlgg_rec type.
-
- when I do:-
-
- goal.head = Alloc(1, SLiteral);
-
-
-
- my gcc compiler complains that
-
-
- >
- rlgg.c:421: warning: assignment from incompatible pointer type
-
- How do I allocate space for goal.head?
-
-
- also how do I allocate space for goal.body,
-
- Since SLiteral is also a complex structure. I tried :-
- > goal.body = (SLiteral *)malloc(sizeof(SLiteral)*(TotalLiteral+1));
-
- This seemed okay, but do I need to allocate space for each goal.body[N] ???
-
- If I do need to then do I just use:-
- > goal.body[N] = (SLiteral *)malloc(sizeof(SLiteral));
-
- This also reterns a warning:-
-
- >rlgg.c:409: warning: assignment from incompatible pointer type
-
- shall I be concern or just ignore the warnings?
-
- Thanks millions
-
- geoff
- .
-
-
-
-